package com.sxhuayuan.parking.exception;

import com.sxhuayuan.parking.compenent.web.RespMessage.Status;
import com.sxhuayuan.parking.utils.SpringUtils;

/**
 * 自定义 RuntimeException 类，此异常时返回json结果
 */

public class MyException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private Status status;

	public MyException(String err) {
		this(Status.ERROR, err);
	}

	public MyException(Status status, String err) {
		super(SpringUtils.getMessage(err));
		this.status = status;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public MyException(Throwable cause) {
		this(Status.ERROR, cause.getMessage());
	}

}
